package com.plian.system.wrapper.hr.hrbackup;

import com.plian.Tools.DateUtil;
import com.plian.system.dto.hr.staff.EducationDegreeDTO;
import com.plian.system.dto.hr.staffBackup.EducationDegreeOldDTO;
import com.plian.system.entity.hr.staff.EducationDegree;
import com.plian.system.entity.hr.staffAnnualBackup.EducationDegreeOld;
import com.plian.system.mybatis.support.BaseWrapper;
import com.plian.system.vo.hr.staff.EducationDegreeVO;
import com.plian.system.vo.hr.staffAnnualBackup.EducationDegreeOldVO;
import com.plian.system.wrapper.util.CacheWrapperUtil;
import com.plian.system.wrapper.util.WrapperUtil;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import static com.plian.system.wrapper.util.WrapperConstant.DICT_CODE_TO_NAME;
import static com.plian.system.wrapper.util.WrapperConstant.SPRING;

/**
 * 学历学位包装类,返回视图层所需的字段
 *
 * @author gangan
 * @since 2019-09-30
 */
@Mapper(componentModel = SPRING, uses = {CacheWrapperUtil.class, WrapperUtil.class})
public interface EducationDegreeOldWrapper extends BaseWrapper<EducationDegreeOld, EducationDegreeOldDTO, EducationDegreeOldVO> {

	@Override
	@Mappings(value = {
			@Mapping(source = "educationTypeId", target = "educationTypeName", qualifiedByName = DICT_CODE_TO_NAME),
			@Mapping(source = "educationalId", target = "educationalName", qualifiedByName = DICT_CODE_TO_NAME),
			@Mapping(source = "degreeId", target = "degreeName" , qualifiedByName = DICT_CODE_TO_NAME),
			@Mapping(source = "startDate", target = "startDateStr" , dateFormat = DateUtil.PATTERN_MONTH),
			@Mapping(source = "endDate", target = "endDateStr" , dateFormat = DateUtil.PATTERN_MONTH)
	})
	EducationDegreeOldVO entityToVO(EducationDegreeOld entity);
}
